<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2021/10/26
  Time: 14:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <button id="testAdd">测试发送宠物</button>
    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>

    <script>
        $("#testAdd").click(function () {
            // $.post("/addPet",
            //     {id:1,name:"小狗",age:1,color:"白色"},
            //     function (res) {
            //         console.log(res);
            //     });
            let pet = {"id":1,"name":"小狗","age":1,"color":"白色","gender":"m",
                "price":11,"type_id":1,"user_id":1,"image":"xx"};
            $.ajax({
                url:"/addPet",
                type:"post",
                dataType:"json",
                contentType:"application/json;charset=UTF-8",
                data:JSON.stringify(pet),
                success(res){
                    console.log(res);
                }
            });
        });
    </script>

</body>
</html>
